#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlEngine>
#include <QQmlContext>
#include <QMediaPlayer>
#include <QVideoProbe>
#include "myvideoproducer.h"
#include "rtspmediaplayer.h"
#include "gstsave2mp4.h"

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;

    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty())
        return -1;

    MyVideoProducer *producer = new MyVideoProducer;
    RtspMediaPlayer *rtspMediaPlayer = new RtspMediaPlayer;

//    rtspMediaPlayer->setVideoSurface(producer->videoSurface());
    GstSave2Mp4 *gstSave2Mp4 = new GstSave2Mp4();
//    gstSave2Mp4->createPipeline();


    engine.rootContext()->setContextProperty("videoProducer", producer);
    engine.rootContext()->setContextProperty("rtspMediaPlayer", rtspMediaPlayer);
    engine.rootContext()->setContextProperty("gstSame2Mp4", gstSave2Mp4);


    return app.exec();
}
